<?php

class Evento extends CActiveRecord {

    public static function model($className=__CLASS__) {
        return parent::model($className);
    }

    public function tableName() {
        return '{{evento}}';
    }

    public function primaryKey() {
        return array('id');
    }


	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('nome, data_inicio, data_fim', 'required'),
			array('nome', 'length', 'max'=>128),
		);
	}

	public function beforeSave()
	{
		$this->data_inicio=dataBanco($this->data_inicio);
		$this->data_fim=dataBanco($this->data_fim);

		return parent::beforeSave();
	}

	public function afterFind()
	{
		$this->data_inicio=data($this->data_inicio);
		$this->data_fim=data($this->data_fim);

		return parent::beforeSave();
	}


}
